# #!/bin/python3
#
# import xmlrpc.client
#
# username = 'via~'  # TODO  your username
# passwd = '1992A1573' # TODO your passwd
# # url = 'http://www.cnblogs.com/' + username + '/services/metaweblog.aspx' # 此链接已挂
# url = 'https://rpc.cnblogs.com/metaweblog/lishikai'
#
# title = "helloWorld"
# content = "<p> test <p>"
# tags = "tag1, tag2"
#
# blogProxy = xmlrpc.client.ServerProxy(url)
#
# # 获取最近博客列表
# print(blogProxy.metaWeblog.getRecentPosts('', username, passwd, 1))
#
# # 发布博客  (其他修改地址：https://rpc.cnblogs.com/metaweblog/lishikai)
# blogProxy.metaWeblog.newPost('', username, passwd, dict(title=title, description=content, mt_keywords=tags), True)
#



import xmlrpc.client

username = 'via~'  # TODO  your username
passwd = '1992A1573' # TODO your passwd
# url = 'http://www.cnblogs.com/' + username + '/services/metaweblog.aspx' # 此链接已挂
url = 'https://rpc.cnblogs.com/metaweblog/lishikai'

title = "helloWorld"
content = "<p> test <p>"
tags = "tag1, tag2"

blogProxy = xmlrpc.client.ServerProxy(url)

# 获取最近博客列表
print(blogProxy.metaWeblog.getRecentPosts('', username, passwd, 1))

# 发布博客  (其他修改地址：https://rpc.cnblogs.com/metaweblog/lishikai)
blogProxy.metaWeblog.newPost('', username, passwd, dict(title=title, description=content, mt_keywords=tags), True)